package com.zijie;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Arrays;

public class Test4 {
	public static void main(String[] args) {
		File f1 = new File("E:\\PR\\a.txt");
		File f2 = new File("E:\\PR\\b.txt");
		try (OutputStream out = new FileOutputStream(f2)){
			out.write(65);
			out.write(69);
			out.write('中');
			out.write('x');
			out.write(10);
			out.write('y');
			out.write('z');
			out.write(-42);
			out.write(-48);
			System.out.println((int)'中');
			System.out.println((byte)'中');
			System.out.println(Arrays.toString("中".getBytes()));
			System.out.println(Arrays.toString("中".getBytes("GBK")));
			System.out.println(Arrays.toString("中".getBytes("UTF-8")));
		} catch (Exception e) {
		e.printStackTrace();
		}
		
		try (OutputStream out = new FileOutputStream(f2);){
				byte [] bs = {65, 66, 67, 13, 10, 97, 98, 99};
				out.write(bs);
				bs = "\n\r中国".getBytes();
				out.write(bs);
				bs = "\n\r中国".getBytes("GBK");
				out.write(bs);
				//out.write(bs,0,bs.length);  //=out.write(bs);
				out.write(bs,0,4);
		} catch (Exception e) {
		e.printStackTrace();
		}
	}
}
